
// 2 div 中放置p标签， h1标签
import {h, init} from "snabbdom"

let patch = init([])

let vnode = h("div#container", [
    h("h1", "Hello Snabbdom"),
    h("p", "这是一个p标签"),
])

let app = document.querySelector("#app")

let oldVal = patch(app, vnode)

setTimeout(() => {
    vnode = h("div#container", [
        h("h1", "Hello world"),
        h("p", "hello P"),
    ])
    // patch(oldVal, vnode)
    // 清除dom
    patch(oldVal, h("!"))
}, 2000);